﻿/*
using System;
using System.IO;
using Microsoft.Office.Interop.Excel;

namespace estoque
{
    public class ExcelSheet : IDisposable
    {
        Application excel;
        Worksheet worksheet;
        string path;

        public Range Cells { get { return this.worksheet.Cells; } }

        public ExcelSheet(string path)
        {
            this.path = path;

            if (File.Exists(path))
            {
                File.Delete(path);
            }

            this.excel = new Microsoft.Office.Interop.Excel.Application();
            //excel.Visible = true;
            excel.Workbooks.Add();
            this.worksheet = new Worksheet();
            this.worksheet = (Worksheet)excel.ActiveWorkbook.ActiveSheet;
        }

        public void Dispose()
        {
            this.worksheet.SaveAs(path);
            this.excel.Quit();
        }

        public void AutoFitColumns(int length)
        {
            for (int i = 1; i <= length; i++)
            {
                Microsoft.Office.Interop.Excel.Range range = (Microsoft.Office.Interop.Excel.Range)this.worksheet.Columns[i];
                range.AutoFit();
            }
        }

        public void AutoFitRows(int length)
        {
            for (int i = 1; i <= length; i++)
            {
                Microsoft.Office.Interop.Excel.Range range = (Microsoft.Office.Interop.Excel.Range)this.worksheet.Rows[i];
                range.AutoFit();
            }
        }
    }
}
*/